<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>吠陀占星图 | 印度占星分析</title>
    <style>
        /* 基础样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            /* 禁用移动端点击蒙层效果 */
            -webkit-tap-highlight-color: transparent;
            tap-highlight-color: transparent;
            outline: none;
        }

        /* 为可点击元素添加特定样式 */
        button,
        [class$="-btn"],
        .zodiac-sign,
        .chart-center,
        .planet,
        .house,
        .nakshatra,
        a,
        [role="button"] {
            /* 禁用移动端点击蒙层效果 */
            -webkit-tap-highlight-color: transparent;
            tap-highlight-color: transparent;
            /* 防止文本选择 */
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            outline: none;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #0a0e17;
            color: #ffffff;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 0;
            overflow-x: hidden;
            overflow-y: auto; /* 允许垂直滚动 */
        }
        
        /* 在iframe中显示时特殊处理 */
        body.in-iframe {
            padding: 20px;
        }

        /* 隐藏所有元素的滚动条但允许滚动 */
        html {
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE and Edge */
        }

        body {
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE and Edge */
        }

        /* Chrome, Safari and Opera */
        html::-webkit-scrollbar,
        body::-webkit-scrollbar {
            display: none;
        }

        /* 确保所有可滚动元素也隐藏滚动条 */
        * {
            scrollbar-width: none; /* Firefox */
        }

        *::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }

        /* 页面标题 */
        header {
            text-align: center;
            margin-bottom: 30px;
            z-index: 10;
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #1dd1a1, #c8d6e5);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            background-size: 300% 300%;
            animation: gradient 15s ease infinite;
        }

        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        .subtitle {
            color: #b2bec3;
            font-size: 1.1rem;
            max-width: 600px;
        }

        /* 出生信息表单 */
        .birth-info-form {
            background: rgba(17, 24, 39, 0.8);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 30px;
            width: 90%;
            max-width: 600px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .form-row {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-bottom: 15px;
        }

        .form-group {
            flex: 1;
            min-width: 200px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #b2bec3;
            font-size: 0.9rem;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            background: rgba(30, 41, 59, 0.8);
            color: white;
            font-size: 1rem;
        }

        .form-group input:focus {
            outline: 2px solid rgba(59, 130, 246, 0.8);
            outline-offset: 2px;
        }

        .calculate-btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(90deg, #54a0ff, #00d2d3);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 1.1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .calculate-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(59, 130, 246, 0.5);
        }

        /* 星盘容器 */
        .chart-container {
            position: relative;
            width: 90vw;
            max-width: 600px;
            height: 90vw;
            max-height: 600px;
            margin: 20px auto;
        }

        /* 星盘底座 */
        .chart-base {
            position: absolute;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background: radial-gradient(circle, #331a7e 0%, #0d1117 100%);
            box-shadow: 0 0 50px rgba(143, 80, 243, 0.3);
            overflow: hidden;
        }

        /* 宫位环 */
        .houses-ring {
            position: absolute;
            width: 90%;
            height: 90%;
            top: 5%;
            left: 5%;
            border-radius: 50%;
        }

        /* 星座环 */
        .zodiac-ring {
            position: absolute;
            width: 80%;
            height: 80%;
            top: 10%;
            left: 10%;
            border-radius: 50%;
        }

        /* 行星环 */
        .planets-ring {
            position: absolute;
            width: 70%;
            height: 70%;
            top: 15%;
            left: 15%;
            border-radius: 50%;
        }

        /* 月宿环 */
        .nakshatra-ring {
            position: absolute;
            width: 60%;
            height: 60%;
            top: 20%;
            left: 20%;
            border-radius: 50%;
        }

        /* 宫位扇区 */
        .house {
            position: absolute;
            width: 50%;
            height: 50%;
            top: 0;
            left: 50%;
            transform-origin: bottom left;
            border: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: flex-start;
            justify-content: center;
            padding-top: 10px;
        }

        .house-number {
            position: absolute;
            top: 15px;
            right: 15px;
            font-size: 0.9rem;
            font-weight: bold;
            color: #b2bec3;
        }

        /* 星座扇区 */
        .zodiac-sector {
            position: absolute;
            width: 50%;
            height: 50%;
            top: 0;
            left: 50%;
            transform-origin: bottom left;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .zodiac-sector-inner {
            position: relative;
            width: 100%;
            height: 100%;
            padding: 15% 10% 10% 10%;
        }

        .zodiac-sign {
            position: absolute;
            transform-origin: center;
            text-align: center;
            width: 50px;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .zodiac-sign:hover {
            transform: scale(1.1);
        }

        .zodiac-icon {
            font-size: 1.2rem;
            margin-bottom: -10px;
            text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
            transform: translateY(20px);
        }

        /* 月宿标记 */
        .nakshatra {
            position: absolute;
            transform-origin: center;
            text-align: center;
            width: 40px;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .nakshatra:hover {
            transform: scale(1.1);
        }

        .nakshatra-icon {
            font-size: 1rem;
            margin-bottom: -8px;
            text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
            transform: translateY(15px);
        }

        /* 行星 */
        .planet {
            position: absolute;
            width: 25px;
            height: 25px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .planet:hover {
            transform: scale(1.2);
            box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
        }

        .planet-icon {
            font-size: 0.9rem;
            color: white;
        }

        /* 星盘中心 */
        .chart-center {
            position: absolute;
            width: 15%;
            height: 15%;
            top: 42.5%;
            left: 42.5%;
            border-radius: 50%;
            background: radial-gradient(circle, #ffd600 0%, #ff8f00 100%);
            box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
            z-index: 5;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .chart-center:hover {
            transform: scale(1.05);
            box-shadow: 0 0 25px rgba(255, 193, 7, 0.9);
        }

        .chart-center::after {
            content: '★';
            font-size: 1.5rem;
            color: white;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
        }

        /* 方向标记 */
        .direction {
            position: absolute;
            z-index: 4;
            font-weight: bold;
            text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
        }

        .north {
            top: 2%;
            left: 50%;
            transform: translateX(-50%);
            color: #ff5252;
        }

        .east {
            top: 50%;
            right: 2%;
            transform: translateY(-50%);
            color: #4caf50;
        }

        .south {
            bottom: 2%;
            left: 50%;
            transform: translateX(-50%);
            color: #2196f3;
        }

        .west {
            top: 50%;
            left: 2%;
            transform: translateY(-50%);
            color: #9c27b0;
        }

        /* 信息面板 */
        .info-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            overflow-x: auto;
            overflow-y: hidden;
            padding-bottom: 10px;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
            /* 固定容器宽度以启用滚动 */
            width: 100%;
            max-width: 100%;
            /* 允许触摸滑动 */
            touch-action: pan-x;
            -ms-touch-action: pan-x;
        }

        /* 隐藏滚动条但保留功能 */
        .info-tabs::-webkit-scrollbar {
            display: none;
        }

        .info-tabs {
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        .info-tab {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: white;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
            /* 确保按钮不会被压缩 */
            flex-shrink: 0;
            /* 确保文本完整显示 */
            min-width: max-content;
        }

        .info-tab:hover {
            background: rgba(59, 130, 246, 0.3);
        }

        .info-tab.active {
            background: rgba(59, 130, 246, 0.8);
            border-color: #3b82f6;
        }

        .info-content {
            background: rgba(17, 24, 39, 0.8);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            padding: 20px;
            width: 90%;
            max-width: 600px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
            margin-bottom: 30px;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        .info-name {
            font-size: 1.2rem;
            font-weight: bold;
            margin-bottom: 10px;
            color: #48dbfb;
        }

        .info-text {
            color: #b2bec3;
            line-height: 1.6;
        }

        /* 控制按钮 */
        .controls-container {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
            margin: 20px 0;
        }

        .controls {
            display: flex;
            gap: 10px;
        }

        .control-btn {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: white;
            padding: 10px 20px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1rem;
        }

        .control-btn:hover {
            background: rgba(59, 130, 246, 0.3);
            border-color: #3b82f6;
        }

        .control-btn.active {
            background: rgba(59, 130, 246, 0.8);
            border-color: #3b82f6;
        }

        /* 重置按钮特殊样式 */
        .reset {
            background: rgba(239, 68, 68, 0.2);
            border-color: rgba(239, 68, 68, 0.5);
        }

        .reset:hover {
            background: rgba(239, 68, 68, 0.3);
            border-color: #ef4444;
        }

        /* 星星背景 */
        .stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }

        .star {
            position: absolute;
            background-color: white;
            border-radius: 50%;
            animation: twinkle 2s infinite alternate;
        }

        @keyframes twinkle {
            from { opacity: 0.3; }
            to { opacity: 1; }
        }

        /* 相位线 */
        .aspects {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            pointer-events: none;
            z-index: 3;
        }

        .aspect-line {
            position: absolute;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
            transform-origin: left center;
            opacity: 0.7;
        }

        /* 特定行星样式 */
        .sun {
            background: radial-gradient(circle, #ffd700, #ff9800);
            box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
        }

        .moon {
            background: radial-gradient(circle, #e0e0e0, #9e9e9e);
            box-shadow: 0 0 15px rgba(224, 224, 224, 0.5);
        }

        .mars {
            background: radial-gradient(circle, #ff5252, #c62828);
            box-shadow: 0 0 15px rgba(255, 82, 82, 0.5);
        }

        .mercury {
            background: radial-gradient(circle, #ffcc80, #ef6c00);
            box-shadow: 0 0 15px rgba(255, 204, 128, 0.5);
        }

        .jupiter {
            background: radial-gradient(circle, #81c784, #388e3c);
            box-shadow: 0 0 15px rgba(129, 199, 132, 0.5);
        }

        .venus {
            background: radial-gradient(circle, #ce93d8, #7b1fa2);
            box-shadow: 0 0 15px rgba(206, 147, 216, 0.5);
        }

        .saturn {
            background: radial-gradient(circle, #b0bec5, #455a64);
            box-shadow: 0 0 15px rgba(176, 190, 197, 0.5);
        }

        .rahu {
            background: radial-gradient(circle, #ff9800, #d84315);
            box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
        }

        .ketu {
            background: radial-gradient(circle, #9c27b0, #4a148c);
            box-shadow: 0 0 15px rgba(156, 39, 176, 0.5);
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            h1 {
                font-size: 2rem;
            }

            .subtitle {
                font-size: 1rem;
            }

            .birth-info-form {
                width: 95%;
                padding: 15px;
            }

            .form-group {
                min-width: 100%;
            }

            .info-content {
                width: 95%;
                padding: 15px;
            }

            .controls {
                flex-wrap: wrap;
                justify-content: center;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 10px;
            }

            h1 {
                font-size: 1.8rem;
            }

            .chart-container {
                width: 95vw;
                height: 95vw;
            }

            .controls {
                flex-direction: column;
                align-items: center;
            }

            .control-btn {
                width: 100%;
                max-width: 200px;
            }
        }
    </style>
</head>
<body>
    <!-- 星星背景 (将通过JS动态生成) -->
    <div class="stars"></div>

    <header>
        <h1>吠陀占星图</h1>
        <p class="subtitle">基于古印度吠陀占星术的个人星盘分析</p>
    </header>

    <!-- 出生信息表单 -->
    <div class="birth-info-form">
        <div class="form-row">
            <div class="form-group">
                <label for="birthDate">出生日期</label>
                <input type="date" id="birthDate" name="birthDate">
            </div>
            <div class="form-group">
                <label for="birthTime">出生时间</label>
                <input type="time" id="birthTime" name="birthTime">
            </div>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label for="birthPlace">出生地点</label>
                <input type="text" id="birthPlace" name="birthPlace" placeholder="城市，国家">
            </div>
        </div>
        <button class="calculate-btn" id="calculateBtn">计算吠陀星盘</button>
    </div>

    <!-- 星盘概览信息 -->
    <div class="info-content">
        <div id="chartSummary" class="info-text">
            请输入您的出生信息并点击"计算吠陀星盘"按钮
        </div>
    </div>

    <!-- 星盘容器 -->
    <div class="chart-container">
        <!-- 星盘底座 -->
        <div class="chart-base"></div>
        
        <!-- 宫位环 -->
        <div class="houses-ring" id="housesRing"></div>
        
        <!-- 星座环 -->
        <div class="zodiac-ring" id="zodiacRing"></div>
        
        <!-- 行星环 -->
        <div class="planets-ring" id="planetsRing"></div>
        
        <!-- 月宿环 -->
        <div class="nakshatra-ring" id="nakshatraRing"></div>
        
        <!-- 相位线 -->
        <div class="aspects" id="aspects"></div>
        
        <!-- 方向标记 -->
        <div class="direction north">北</div>
        <div class="direction east">东</div>
        <div class="direction south">南</div>
        <div class="direction west">西</div>
        
        <!-- 星盘中心 -->
        <div class="chart-center" id="centerButton"></div>
    </div>

    <!-- 控制按钮 -->
    <div class="controls-container">
        <div class="controls">
            <button class="control-btn" id="rotateBtn">旋转星盘</button>
            <button class="control-btn reset" id="resetBtn">重置</button>
        </div>
    </div>

    <!-- 信息面板 -->
    <div class="info-tabs">
        <button class="info-tab active" data-tab="overview">概览</button>
        <button class="info-tab" data-tab="planets">行星</button>
        <button class="info-tab" data-tab="zodiac">星座</button>
        <button class="info-tab" data-tab="nakshatras">月宿</button>
        <button class="info-tab" data-tab="houses">宫位</button>
        <button class="info-tab" data-tab="aspects">相位</button>
    </div>

    <!-- 信息内容 -->
    <div class="info-content">
        <!-- 概览选项卡 -->
        <div class="tab-content active" id="overview">
            <div class="info-name">吠陀占星概览</div>
            <div class="info-text">
                吠陀占星术（Jyotish）是古印度的传统占星体系，有着数千年的历史。与西方占星不同，吠陀占星使用恒星黄道带，更注重个人的业力和灵魂成长路径。
                <br><br>
                吠陀占星图包含12个星座、12个宫位、9颗行星（包括罗睺和计都两个虚点）以及27个月宿（Nakshatras）。
            </div>
        </div>

        <!-- 行星选项卡 -->
        <div class="tab-content" id="planets">
            <div class="info-name">行星解读</div>
            <div class="info-text">
                请选择行星查看详细解读。
            </div>
        </div>

        <!-- 星座选项卡 -->
        <div class="tab-content" id="zodiac">
            <div class="info-name">星座解读</div>
            <div class="info-text">
                吠陀占星使用12个星座，每个星座与特定的元素、能量和特征相关联。
            </div>
        </div>

        <!-- 月宿选项卡 -->
        <div class="tab-content" id="nakshatras">
            <div class="info-name">月宿解读</div>
            <div class="info-text">
                吠陀占星包含27个月宿（Nakshatras），每个月宿代表特定的能量和影响力。月宿在吠陀占星中扮演着重要角色，尤其对于性格分析和事件预测。
            </div>
        </div>

        <!-- 宫位选项卡 -->
        <div class="tab-content" id="houses">
            <div class="info-name">宫位解读</div>
            <div class="info-text">
                吠陀占星中的12个宫位代表生活的不同领域，从自我、家庭到事业和灵性成长。
            </div>
        </div>

        <!-- 相位选项卡 -->
        <div class="tab-content" id="aspects">
            <div class="info-name">相位解读</div>
            <div class="info-text">
                行星之间的相位关系显示了能量的互动方式，对个人性格和生活事件有着重要影响。
            </div>
        </div>
    </div>

    <script>
        // 吠陀占星中的星座数据
        const zodiacSigns = [
            { name: '白羊座', symbol: '♈', element: '火', lord: '火星' },
            { name: '金牛座', symbol: '♉', element: '土', lord: '金星' },
            { name: '双子座', symbol: '♊', element: '风', lord: '水星' },
            { name: '巨蟹座', symbol: '♋', element: '水', lord: '月亮' },
            { name: '狮子座', symbol: '♌', element: '火', lord: '太阳' },
            { name: '室女座', symbol: '♍', element: '土', lord: '水星' },
            { name: '天秤座', symbol: '♎', element: '风', lord: '金星' },
            { name: '天蝎座', symbol: '♏', element: '水', lord: '火星' },
            { name: '人马座', symbol: '♐', element: '火', lord: '木星' },
            { name: '摩羯座', symbol: '♑', element: '土', lord: '土星' },
            { name: '宝瓶座', symbol: '♒', element: '风', lord: '土星' },
            { name: '双鱼座', symbol: '♓', element: '水', lord: '木星' }
        ];

        // 吠陀占星中的月宿数据
        const nakshatras = [
            { name: 'Ashwini', symbol: '马', lord: '凯龙星' },
            { name: 'Bharani', symbol: '母熊', lord: '金星' },
            { name: 'Krittika', symbol: '刀', lord: '太阳' },
            { name: 'Rohini', symbol: '鹿', lord: '月亮' },
            { name: 'Mrigashira', symbol: '瞪羚', lord: '火星' },
            { name: 'Ardra', symbol: '钻石', lord: '罗睺' },
            { name: 'Punarvasu', symbol: '弓箭', lord: '木星' },
            { name: 'Pushya', symbol: '奶牛', lord: '土星' },
            { name: 'Ashlesha', symbol: '蛇', lord: '水星' },
            { name: 'Magha', symbol: '宫殿', lord: '凯龙星' },
            { name: 'Purva Phalguni', symbol: '床', lord: '金星' },
            { name: 'Uttara Phalguni', symbol: '床脚', lord: '太阳' },
            { name: 'Hasta', symbol: '手', lord: '月亮' },
            { name: 'Chitra', symbol: '珍珠', lord: '火星' },
            { name: 'Swati', symbol: '剑', lord: '罗睺' },
            { name: 'Vishaka', symbol: '分叉', lord: '木星' },
            { name: 'Anuradha', symbol: '莲花', lord: '土星' },
            { name: 'Jyeshtha', symbol: '大象', lord: '水星' },
            { name: 'Mula', symbol: '根', lord: '凯龙星' },
            { name: 'Purva Ashadha', symbol: '胜利旗', lord: '金星' },
            { name: 'Uttara Ashadha', symbol: '胜利旗顶', lord: '太阳' },
            { name: 'Shravana', symbol: '耳', lord: '月亮' },
            { name: 'Dhanishta', symbol: '笛子', lord: '火星' },
            { name: 'Shatabhisha', symbol: '100朵花', lord: '罗睺' },
            { name: 'Purva Bhadrapada', symbol: '前棺', lord: '木星' },
            { name: 'Uttara Bhadrapada', symbol: '后棺', lord: '土星' },
            { name: 'Revati', symbol: '鱼', lord: '水星' }
        ];

        // 吠陀占星中的行星数据
        const planets = [
            { name: '太阳', symbol: '☉', degrees: 45, element: '火', color: '#ffd700' },
            { name: '月亮', symbol: '☽', degrees: 90, element: '水', color: '#e0e0e0' },
            { name: '火星', symbol: '♂', degrees: 135, element: '火', color: '#ff5252' },
            { name: '水星', symbol: '☿', degrees: 180, element: '风', color: '#ffcc80' },
            { name: '木星', symbol: '♃', degrees: 225, element: '木', color: '#81c784' },
            { name: '金星', symbol: '♀', degrees: 270, element: '土', color: '#ce93d8' },
            { name: '土星', symbol: '♄', degrees: 315, element: '土', color: '#b0bec5' },
            { name: '罗睺', symbol: '☊', degrees: 340, element: '水', color: '#ff9800' },
            { name: '计都', symbol: '☋', degrees: 20, element: '水', color: '#9c27b0' },
        ];

        // 生成星座符号
        function generateZodiacSigns() {
            const zodiacRing = document.getElementById('zodiacRing');
            const sectorAngle = 30; // 每个星座30度

            zodiacSigns.forEach((sign, index) => {
                // 创建星座扇区
                const sector = document.createElement('div');
                sector.className = 'zodiac-sector';
                sector.style.transform = `rotate(${index * sectorAngle}deg)`;
                
                // 创建星座内部元素
                const inner = document.createElement('div');
                inner.className = 'zodiac-sector-inner';
                
                // 创建星座符号
                const zodiacSign = document.createElement('div');
                zodiacSign.className = 'zodiac-sign';
                zodiacSign.style.transform = `rotate(${sectorAngle / 2}deg) translate(-50%, -50%)`;
                
                const icon = document.createElement('div');
                icon.className = 'zodiac-icon';
                icon.textContent = sign.symbol;
                
                zodiacSign.appendChild(icon);
                inner.appendChild(zodiacSign);
                sector.appendChild(inner);
                zodiacRing.appendChild(sector);
                
                // 添加点击事件
                zodiacSign.addEventListener('click', () => showZodiacInfo(sign));
            });
        }

        // 生成月宿标记
        function generateNakshatras() {
            const nakshatraRing = document.getElementById('nakshatraRing');
            const sectorAngle = 360 / 27; // 每个月宿约13.33度

            nakshatras.forEach((nakshatra, index) => {
                // 创建月宿标记
                const nakshatraSign = document.createElement('div');
                nakshatraSign.className = 'nakshatra';
                
                // 计算位置
                const angle = index * sectorAngle + sectorAngle / 2;
                const radius = 50; // 百分比
                const radians = (angle - 90) * Math.PI / 180;
                const x = 50 + radius * Math.cos(radians);
                const y = 50 + radius * Math.sin(radians);
                
                // 设置位置和旋转
                nakshatraSign.style.left = `${x}%`;
                nakshatraSign.style.top = `${y}%`;
                nakshatraSign.style.transform = `translate(-50%, -50%)`;
                
                const icon = document.createElement('div');
                icon.className = 'nakshatra-icon';
                icon.textContent = nakshatra.name.charAt(0); // 显示首字母
                
                nakshatraSign.appendChild(icon);
                nakshatraRing.appendChild(nakshatraSign);
                
                // 添加点击事件
                nakshatraSign.addEventListener('click', () => showNakshatraInfo(nakshatra));
            });
        }

        // 生成宫位
        function generateHouses() {
            const housesRing = document.getElementById('housesRing');
            const sectorAngle = 30; // 每个宫位30度

            for (let i = 0; i < 12; i++) {
                // 创建宫位扇区
                const house = document.createElement('div');
                house.className = 'house';
                house.style.transform = `rotate(${i * sectorAngle}deg)`;
                
                // 添加宫位编号
                const houseNumber = document.createElement('div');
                houseNumber.className = 'house-number';
                houseNumber.textContent = i + 1;
                
                house.appendChild(houseNumber);
                housesRing.appendChild(house);
                
                // 添加点击事件
                const houseData = { number: i + 1 };
                house.addEventListener('click', () => showHouseInfo(houseData));
            }
        }

        // 生成行星
        function generatePlanets() {
            const planetsRing = document.getElementById('planetsRing');
            const radius = 50; // 百分比

            planets.forEach(planet => {
                // 创建行星元素
                const planetElement = document.createElement('div');
                planetElement.className = `planet ${planet.name.toLowerCase()}`;
                
                // 计算位置
                const radians = (planet.degrees - 90) * Math.PI / 180;
                const x = 50 + radius * Math.cos(radians);
                const y = 50 + radius * Math.sin(radians);
                
                // 设置位置
                planetElement.style.left = `${x}%`;
                planetElement.style.top = `${y}%`;
                
                const icon = document.createElement('div');
                icon.className = 'planet-icon';
                icon.textContent = planet.symbol;
                
                planetElement.appendChild(icon);
                planetsRing.appendChild(planetElement);
                
                // 添加点击事件
                planetElement.addEventListener('click', () => showPlanetInfo(planet));
            });
        }

        // 生成相位线
        function generateAspects() {
            const aspectsContainer = document.getElementById('aspects');
            
            // 为了简化，这里只显示部分相位关系
            // 在实际应用中，应该根据行星之间的角度计算相位
            
            // 太阳与月亮的相位线
            const sun = planets.find(p => p.name === '太阳');
            const moon = planets.find(p => p.name === '月亮');
            
            if (sun && moon) {
                const aspectLine = document.createElement('div');
                aspectLine.className = 'aspect-line';
                
                // 计算角度和长度
                const angle = (sun.degrees + moon.degrees) / 2;
                const distance = Math.abs(sun.degrees - moon.degrees);
                const length = 100 * (1 - Math.min(distance, 360 - distance) / 360);
                
                // 设置样式
                aspectLine.style.transform = `rotate(${angle}deg)`;
                aspectLine.style.width = `${length}%`;
                aspectLine.style.left = '50%';
                aspectLine.style.top = '50%';
                
                aspectsContainer.appendChild(aspectLine);
            }
        }

        // 防抖函数
        function debounce(func, wait) {
            let timeout;
            return function() {
                const context = this;
                const args = arguments;
                clearTimeout(timeout);
                timeout = setTimeout(() => func.apply(context, args), wait);
            };
        }

        // 显示星座信息
        function showZodiacInfo(sign) {
            // 切换到星座选项卡
            switchTab('zodiac');
            
            // 实际应用中可以根据需要更新星座详情
            const zodiacDetails = document.getElementById('zodiac').querySelector('.info-text');
            zodiacDetails.innerHTML = `<strong>${sign.name} (${sign.symbol})</strong><br><br>`;
            zodiacDetails.innerHTML += `元素: ${sign.element}<br>`;
            zodiacDetails.innerHTML += `守护星: ${sign.lord}<br><br>`;
            
            // 添加星座描述
            let description = '';
            switch(sign.name) {
                case '白羊座':
                    description = '白羊座在吠陀占星中象征着新的开始和勇气。代表着行动力、领导力和独立性。';
                    break;
                case '金牛座':
                    description = '金牛座代表稳定性、耐心和物质享受。象征着坚定、可靠和对美好事物的追求。';
                    break;
                case '双子座':
                    description = '双子座象征着沟通、学习和多样性。代表着机智、好奇心和适应能力。';
                    break;
                case '巨蟹座':
                    description = '巨蟹座代表家庭、情感和直觉。象征着保护欲、同理心和情感深度。';
                    break;
                case '狮子座':
                    description = '狮子座象征着自信、创造力和领导力。代表着尊严、热情和慷慨。';
                    break;
                case '室女座':
                    description = '室女座代表分析、实用和服务。象征着精确、组织能力和对完美的追求。';
                    break;
                case '天秤座':
                    description = '天秤座象征着平衡、和谐和关系。代表着公平、外交手腕和审美能力。';
                    break;
                case '天蝎座':
                    description = '天蝎座代表深度、转化和力量。象征着激情、直觉和意志力。';
                    break;
                case '人马座':
                    description = '人马座象征着扩张、冒险和哲学。代表着乐观、自由精神和对知识的追求。';
                    break;
                case '摩羯座':
                    description = '摩羯座代表责任、成就和结构。象征着耐心、纪律和实用主义。';
                    break;
                case '宝瓶座':
                    description = '宝瓶座象征着创新、独立和人道主义。代表着原创性、进步思想和社会意识。';
                    break;
                case '双鱼座':
                    description = '双鱼座代表直觉、灵性和同理心。象征着想象力、慈悲和超越物质的追求。';
                    break;
            }
            
            zodiacDetails.innerHTML += description;
        }

        // 显示月宿信息
        function showNakshatraInfo(nakshatra) {
            // 切换到月宿选项卡
            switchTab('nakshatras');
            
            // 实际应用中可以根据需要更新月宿详情
            const nakshatraDetails = document.getElementById('nakshatras').querySelector('.info-text');
            nakshatraDetails.innerHTML = `<strong>${nakshatra.name}</strong><br><br>`;
            nakshatraDetails.innerHTML += `象征: ${nakshatra.symbol}<br>`;
            nakshatraDetails.innerHTML += `守护星: ${nakshatra.lord}<br><br>`;
            
            // 添加月宿描述
            let description = '';
            // 这里可以根据需要添加更多月宿的详细描述
            description = '月宿在吠陀占星中代表着月亮的27个停留位置，每个月宿都有独特的能量和象征意义。月宿对个人的性格塑造和生活事件有着重要影响。';
            
            nakshatraDetails.innerHTML += description;
        }

        // 显示宫位信息
        function showHouseInfo(house) {
            // 切换到宫位选项卡
            switchTab('houses');
            
            // 实际应用中可以根据需要更新宫位详情
            const houseDetails = document.getElementById('houses').querySelector('.info-text');
            houseDetails.innerHTML = `<strong>第${house.number}宫</strong><br><br>`;
            
            // 添加宫位描述
            let description = '';
            switch(house.number) {
                case 1:
                    description = '第一宫代表自我、个性和外在形象。它反映了你的身份认同和如何展现自己。';
                    break;
                case 2:
                    description = '第二宫代表财富、价值观和物质资源。它反映了你与金钱和物质的关系。';
                    break;
                case 3:
                    description = '第三宫代表沟通、兄弟姐妹和短途旅行。它反映了你的思维方式和交流能力。';
                    break;
                case 4:
                    description = '第四宫代表家庭、根源和内心安全感。它反映了你的家庭生活和情感基础。';
                    break;
                case 5:
                    description = '第五宫代表创造力、爱情和子女。它反映了你的自我表达和娱乐方式。';
                    break;
                case 6:
                    description = '第六宫代表健康、工作和日常责任。它反映了你的工作态度和健康状况。';
                    break;
                case 7:
                    description = '第七宫代表关系、婚姻和合作。它反映了你与他人的互动方式和伴侣关系。';
                    break;
                case 8:
                    description = '第八宫代表转变、神秘和共享资源。它反映了你的深层心理和生活转变。';
                    break;
                case 9:
                    description = '第九宫代表哲学、高等教育和长途旅行。它反映了你的信仰系统和精神追求。';
                    break;
                case 10:
                    description = '第十宫代表事业、地位和公众形象。它反映了你的职业目标和社会地位。';
                    break;
                case 11:
                    description = '第十一宫代表朋友、社会网络和希望。它反映了你的社交圈和未来愿景。';
                    break;
                case 12:
                    description = '第十二宫代表灵性、孤立和潜意识。它反映了你的内在世界和精神成长。';
                    break;
            }
            
            houseDetails.innerHTML += description;
        }

        // 显示行星信息
        function showPlanetInfo(planet) {
            // 切换到行星选项卡
            switchTab('planets');
            
            // 实际应用中可以根据需要更新行星详情
            const planetDetails = document.getElementById('planets').querySelector('.info-text');
            planetDetails.innerHTML = `<strong>${planet.name} (${planet.symbol})</strong><br><br>`;
            planetDetails.innerHTML += `元素: ${planet.element}<br>`;
            planetDetails.innerHTML += `位于 ${getZodiacByDegrees(planet.degrees).name} ${Math.round(planet.degrees % 30)} 度<br><br>`;
            
            // 添加行星具体描述
            let description = '';
            switch(planet.name) {
                case '太阳':
                    description = '在吠陀占星中，太阳代表自我、灵魂和生命力。它象征着你的核心本质、领导力和精神成长。';
                    break;
                case '月亮':
                    description = '月亮在吠陀占星中代表心灵、情绪和直觉。它反映了你的情感需求、内心安全感和记忆。';
                    break;
                case '火星':
                    description = '火星代表勇气、能量和行动力。它反映了你的热情、竞争意识和实现目标的决心。';
                    break;
                case '水星':
                    description = '水星代表智力、沟通和学习。它反映了你的思维方式、表达能力和解决问题的能力。';
                    break;
                case '木星':
                    description = '木星代表扩张、幸运和智慧。它反映了你的成长、教育和哲学视角。';
                    break;
                case '金星':
                    description = '金星代表爱、美和和谐。它反映了你的人际关系、审美偏好和享受生活的方式。';
                    break;
                case '土星':
                    description = '土星代表责任、纪律和限制。它反映了你的耐心、毅力和生活中的挑战与教训。';
                    break;
                case '罗睺':
                    description = '罗睺是一个虚点，代表欲望、执着和物质追求。它反映了你的业力挑战和需要超越的执着。';
                    break;
                case '计都':
                    description = '计都是一个虚点，代表精神成长、直觉和超越。它反映了你的灵性追求和对更高意识的渴望。';
                    break;
            }
            
            planetDetails.innerHTML += description;
        }

        // 根据度数获取星座
        function getZodiacByDegrees(degrees) {
            const normalizedDegrees = degrees % 360;
            const index = Math.floor(normalizedDegrees / 30);
            return zodiacSigns[index];
        }

        // 切换信息选项卡
        function switchTab(tabId) {
            const tabs = document.querySelectorAll('.info-tab');
            const tabContents = document.querySelectorAll('.tab-content');

            tabs.forEach(tab => {
                tab.classList.remove('active');
                if (tab.getAttribute('data-tab') === tabId) {
                    tab.classList.add('active');
                }
            });

            tabContents.forEach(content => {
                content.classList.remove('active');
                if (content.id === tabId) {
                    content.classList.add('active');
                }
            });
        }

        // 旋转星盘
        function rotateChart(degrees) {
            const housesRing = document.getElementById('housesRing');
            const zodiacRing = document.getElementById('zodiacRing');
            const planetsRing = document.getElementById('planetsRing');
            const nakshatraRing = document.getElementById('nakshatraRing');
            const aspectsContainer = document.getElementById('aspects');

            // 清除现有的相位线
            while (aspectsContainer.firstChild) {
                aspectsContainer.removeChild(aspectsContainer.firstChild);
            }

            // 应用旋转
            housesRing.style.transform = `rotate(${degrees}deg)`;
            zodiacRing.style.transform = `rotate(${degrees}deg)`;
            planetsRing.style.transform = `rotate(${degrees}deg)`;
            nakshatraRing.style.transform = `rotate(${degrees}deg)`;

            // 重新生成相位线
            generateAspects();
        }

        // 计算吠陀星盘
        function calculateVedicChart() {
            const birthDate = document.getElementById('birthDate').value;
            const birthTime = document.getElementById('birthTime').value;
            const birthPlace = document.getElementById('birthPlace').value;

            // 显示计算中的提示
            alert('正在计算你的吠陀星盘...\n这是一个示例，实际应用中需要调用吠陀星盘计算API');

            // 更新星盘概览信息
            const dateObj = new Date(birthDate);
            const formattedDate = `${dateObj.getFullYear()}年${dateObj.getMonth() + 1}月${dateObj.getDate()}日 ${birthTime} | 地点: ${birthPlace}`;
            document.getElementById('chartSummary').textContent = formattedDate;

            // 这里应该调用吠陀星盘计算API获取实际的行星位置、宫位等信息
            // 为了演示，我们使用预设的数据
            
            // 清除现有的行星
            const planetsRing = document.getElementById('planetsRing');
            while (planetsRing.firstChild) {
                planetsRing.removeChild(planetsRing.firstChild);
            }

            // 重新生成行星
            generatePlanets();
        }

        // 生成星星背景
        function createStars() {
            const starsContainer = document.querySelector('.stars');
            const starCount = 150;

            for (let i = 0; i < starCount; i++) {
                const star = document.createElement('div');
                star.className = 'star';

                // 随机位置
                const x = Math.random() * 100;
                const y = Math.random() * 100;

                // 随机大小
                const size = Math.random() * 2 + 1;

                // 随机闪烁延迟
                const delay = Math.random() * 3;

                star.style.left = `${x}%`;
                star.style.top = `${y}%`;
                star.style.width = `${size}px`;
                star.style.height = `${size}px`;
                star.style.animationDelay = `${delay}s`;

                starsContainer.appendChild(star);
            }
        }

        // 优化滑动体验的函数
        function optimizeScrolling() {
            // 1. 通过CSS设置触摸行为，允许垂直滑动
            document.body.style.touchAction = 'pan-y';
            document.body.style.overscrollBehavior = 'contain';

            // 2. 定义变量用于触摸控制
            let startX = null;
            let startY = null;
            let isVerticalScrolling = false;
            const HORIZONTAL_THRESHOLD = 10; // 放宽水平滑动检测阈值
            const VERTICAL_MIN_DISTANCE = 5; // 垂直滑动最小距离

            // 触摸开始事件
            document.addEventListener('touchstart', (e) => {
                startX = e.touches[0].clientX;
                startY = e.touches[0].clientY;
                isVerticalScrolling = false;
            }, { passive: true });

            // 触摸移动事件 - 优化版，优先保证垂直滑动体验
            document.addEventListener('touchmove', (e) => {
                if (!startX || !startY) return;

                // 计算滑动距离
                const touchX = e.touches[0].clientX;
                const touchY = e.touches[0].clientY;
                const diffX = Math.abs(touchX - startX);
                const diffY = Math.abs(touchY - startY);

                // 确定是否为垂直滚动
                if (!isVerticalScrolling && diffY > VERTICAL_MIN_DISTANCE) {
                    isVerticalScrolling = true;
                }

                // 只有当明显是水平滑动时才阻止
                if (!isVerticalScrolling && diffX > HORIZONTAL_THRESHOLD && diffX > diffY) {
                    e.preventDefault();
                }
                // 如果已经确定为垂直滚动，则允许继续滚动
                // 这里不使用passive: false可以提高性能
            }, { passive: true });

            // 3. 手势处理 - 只在必要时阻止
            document.addEventListener('gesturestart', (e) => {
                e.preventDefault();
            }, { passive: false });

            // 4. 优化水平位置控制 - 减少过度干预
            let lastScrollTime = 0;
            const SCROLL_DELAY = 50; // 滚动事件防抖延迟

            window.addEventListener('scroll', () => {
                const now = Date.now();
                // 防抖处理，避免过于频繁地干预滚动
                if (now - lastScrollTime > SCROLL_DELAY && window.scrollX !== 0) {
                    lastScrollTime = now;
                    window.scrollTo(0, window.scrollY);
                }
            }, { passive: true });
        }

        // 添加事件监听器
        function addEventListeners() {
            // 计算按钮
            document.getElementById('calculateBtn').addEventListener('click', calculateVedicChart);

            // 重置按钮
            document.getElementById('resetBtn').addEventListener('click', () => {
                rotateChart(0);
            });

            // 旋转按钮
            document.getElementById('rotateBtn').addEventListener('click', () => {
                const randomRotation = Math.floor(Math.random() * 360);
                rotateChart(randomRotation);
            });

            // 中心按钮
            document.getElementById('centerButton').addEventListener('click', () => {
                const randomRotation = Math.floor(Math.random() * 360);
                rotateChart(randomRotation);
            });

            // 选项卡切换
            document.querySelectorAll('.info-tab').forEach(tab => {
                tab.addEventListener('click', () => {
                    switchTab(tab.getAttribute('data-tab'));
                });
            });
        }

        // 自动设置今天的日期作为默认值
        function setDefaultDate() {
            const today = new Date();
            const year = today.getFullYear();
            const month = String(today.getMonth() + 1).padStart(2, '0');
            const day = String(today.getDate()).padStart(2, '0');
            document.getElementById('birthDate').value = `${year}-${month}-${day}`;
            document.getElementById('birthTime').value = '12:00';
        }

        // 页面加载完成后初始化
        window.addEventListener('load', () => {
            setDefaultDate();
            createStars();
            generateZodiacSigns();
            generateHouses();
            generatePlanets();
            generateNakshatras(); // 生成月宿
            generateAspects();
            addEventListeners();
            optimizeScrolling(); // 优化滑动体验
        });
    </script>
</body>
</html>